{extend name=".././view/create.html" /}
{block name="form"}
<form class="layui-form layui-form-pane" lay-filter="myform">
	<div class="layui-form-item">
		<label for="school_id" class="layui-form-label">学校</label>
		<div class="layui-input-block">
			<select name="school_id" id="school_id" lay-filter="src">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label for="ruxuenian" class="layui-form-label">年级</label>
		<div class="layui-input-block">
			<select name="ruxuenian" id="ruxuenian" lay-filter="src">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label for="subject_id" class="layui-form-label">
			<span class="x-red">*</span>学科
		</label>
		<div class="layui-input-block">
			<select name="subject_id" id="subject_id">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label for="banji_id" class="layui-form-label"><span class="x-red">*</span>班级</label>
		<div class="layui-input-block" id="banji_id">
		</div>
	</div>
	<div class="layui-form-item">
		<label for="teacher_name" class="layui-form-label">
			<span class="x-red">*</span>教师姓名
		</label>
		<div class="layui-input-block" id="teacher_id" school_id="0">
		</div>
	</div>
	<input type="hidden" name="kaoshi_id" id="kaoshi_id" value="{$list.data.kaoshi_id}">
	<div class="layui-form-item" style="text-align: right;">
		<button class="layui-btn" lay-filter="mysubmit" lay-submit="">
			{$list.set.butname}
		</button>
	</div>
</form>
{/block}
{block name="myjs"}
<script>
layui.use(['createInput', 'canyuKaoshi', 'form'], function() {
	var cInput = layui.createInput,
		canyu = layui.canyuKaoshi,
		form = layui.form;

	// 搜索教师

	xmselect = cInput.searchTeacher('teacher_id', true);
	canyu.schoolSelect('school_id', "{$list.data.kaoshi_id}");
	canyu.gradeSelect('ruxuenian', "{$list.data.kaoshi_id}");

	// 监听学校下拉菜单
	form.on('select(src)', function(data) {
		data = form.val("myform");
		if (data.school_id > 0 && data.ruxuenian > 0) {
			canyu.banjiCheckbox('banji_id', data);
		}
		canyu.btjSubjectSelect('subject_id', data);
    $('#teacher_id').attr('school_id', data.school_id)
	});

	form.on('checkbox(mycheackbox)', function(data) {
		cInput.checkboxChecked(data);
	});
});

</script>
{/block}
